<?php

class Exception_Validation extends Exception_Public {

	/**
	 *
	 * @var array
	 */
	protected $messages = array();

	/**
	 *
	 * @return array
	 */
	public function getMessages() {
		return $this->messages;
	}

	/**
	 *
	 * @param array $messages
	 * @param string|null $prefix
	 * @param string $msg
	 * @param int $code
	 * @param Exception $previous
	 */
	public function  __construct(array $messages, $prefix = null, $msg = 'Данные не прошли валидацию', $code = 0, Exception $previous = null) {
		
		if ($prefix) {
			$this->messages = ErrorMessages::wrapKeys($messages, $prefix);
		}
		else {
			$this->messages = $messages;
		}
		
		parent::__construct($msg, $code, $previous);
	}
}